package com.magenta.maxoptra.gis.utils;


import com.magenta.maxoptra.gis.GeoAddress;

/**
 * Created with IntelliJ IDEA.
 * User: kuznetsovd
 * Date: 05.12.12
 * Time: 13:24
 * To change this template use File | Settings | File Templates.
 */
public class DoForwardGeocodingProfiler extends AbstractGisProfiler {

    private final String request;

    public DoForwardGeocodingProfiler(String provider, String accountGlobalId, boolean enableProfiling, GeoAddress address) {
        super(provider, accountGlobalId, enableProfiling);
        this.request = address.toString();
    }

    public DoForwardGeocodingProfiler(String provider, String accountGlobalId, boolean enableProfiling, String keyWord) {
        super(provider, accountGlobalId, enableProfiling);
        this.request = keyWord;
    }

    public String getInitialInfo() {
        return provider + separator + accountGlobalId + separator + request;
    }

    @Override
    public void logDuration(String action) {
        super.logDuration("geocoding.forward:" + action);
    }

    public void logDuration(int count) {
        super.logDuration("geocoding.forward.result.count:" + count);
    }

    public void logDuration(GeoAddress address) {
        super.logDuration("geocoding.forward:" + (address!=null?address.toString():"UNKNOWN"));
    }

}
